using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class GameMenu : BasePanel
{
    [SerializeField] private Button returnGame;
    [SerializeField] private Button saveData;
    [SerializeField] private Button setting;
    [SerializeField] private Button exitGame;

    private void Start()
    {
        returnGame.onClick.AddListener(() =>
        {
            // 继续游戏
            TimeSystem.Instance.TakeGameTime(false);
            // 关闭面板
            UIManager.Instance.ClosePanel(UIConst.GAMEMENU);
        });
        
        saveData.onClick.AddListener(() =>
        {
            SaveManager.Instance.SaveGameData();
        });
        
        setting.onClick.AddListener(() =>
        {
            UIManager.Instance.OpenPanel(UIConst.SETTING);
        });
        
        exitGame.onClick.AddListener(() =>
        {
            UIManager.Instance.ClosePanel(UIConst.GAMEMENU);
            TimeSystem.Instance.TakeGameTime(false);
            SceneManager.LoadScene(0);
        });
    }
}
